<?php 

namespace Admin\Controller;
use Think\Controller;
class FoodController extends BaseController{

public function FoodList(){

            $foodModel=M('food');
            $food=$foodModel->order('fid')->select();
            $this->food=$food;
            $this->display();          
}
public function deluser($id){
        //$id = $_GET['id'];
    $foodModel=M('food');
    $res=$foodModel->where("fid=$id")->find();
    //echo $res->getLastSql();
       $photoPath=realpath('./Public/Admin/photo/'.$res['photo']);
        if($res['photo']!=='default.jpg')
        {
        unlink($photoPath);}
    if(false!==$foodModel->where("fid=$id")->delete())
        $this->success('删除成功！');
    else
        { $this->error('删除失败');
    }
       
}




}


 ?>